<?php

	#doc
	#	classname:	afishaController
	#	scope:		PUBLIC
	#
	#/doc
	
	class afishaController extends Controller		
	{
		#	internal variables
		
		
		
			// Выборка по сегодняшнй дате
			public function actionList()
			{	
				$list= new event_time();
				
				$date= date('Y-m-d');					
					$limit=7;
					$sdvig=0;
					
				$spisok = $list->output_event_date($date,$limit,$sdvig);
				$this->render('list', array('spisok'=>$spisok));
			}
			// Выюорка по дате
			public function actionDate()
			{
				$date=$_GET['date'];
				$list_date= new event_time();
				$limit=6;
				$sdvig=0;
				$spisok = $list_date->output_event_date($date,$limit,$sdvig);
				$this->render('list', array('spisok'=>$spisok));
			}	
			public function actionTag()	
			{
				$tag= $_GET['tag'];
				$date= date('Y-m-d');
				
				$criteria=new CDbCriteria;
					$criteria->condition="tag_name=:tag_name";
						$criteria->params=array(':tag_name'=>$tag);
							
				$spisok = link_tag::model()->with('event','event_time')->findAll($criteria);

				//$spisok=model()
					if($tag=='Кино')
					{		
					$spisok = event_time::model()->with('event','link_tag')->findAll('date=:date',array(':date'=>$date),$criteria);				
						$Theatre= thinema_theatre::model()->findAll();
						$this->render('filmlist',array('spisok'=>$spisok,'Theatre'=>$Theatre,'time'=>$time));	
					}
					else
					{
						$this->render('list', array('spisok'=>$spisok));
					}
			}
			
			public function actionView()
			{
				$id=$_GET['id'];
				if(isset($id))
				{
					$event=events::model()->findByPk($id);
				}

			$this->render('view',array('event'=>$event));
			}
			

	
	}
	

?>